home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16169 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.dal.ca!news
  2. From: Klaus.Eichele@Dal.Ca (Klaus Eichele)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Strange error
  5. Date: Wed, 10 Apr 1996 01:27:19 GMT
  6. Organization: Dalhousie University
  7. Message-ID: <4keknp$stj@News.Dal.Ca>
  8. References: <1996Apr9.111558@winnie>
  9. NNTP-Posting-Host: rewasylishen.chem.dal.ca
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. zhou@wmich.edu wrote:
  13.  
  14. >    I have been stymied by an error which occurs during run time for
  15. >certain programs I've written in TC++.  What ever I do I cannot find the
  16. >cause of it.  The error says something to the effect of "Floating point
  17. >error: Domain." or "Domain Error" and "abnormal program termination".  What
  18. >is usually the cause of this?  Thanks.
  19.  
  20. Hi,
  21. typical sources of such errors are trigonometric functions. 
  22. For example, if you want to know the angle corresponding to a given
  23. cosine and use acos(x), where  x is outside the defined range (x <
  24. -1.0 or x > 1.0), you will get such an errors. They happen sometimes
  25. as a consequence of round-off errors, e.g., if the above x is obtained
  26. by computations. Instead of the ideal case, 1.0000000, you might get
  27. something slightly bigger, 1.000007. However, this will still cause
  28. the acos() function to bomb. Analogous problems may happen with other
  29. mathematical functions. Once you locate the critical function call,
  30. you might need to insert a test/correction, before doing the function
  31. call. 
  32.  
  33. Good Luck,
  34. Klaus
  35. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. Klaus Eichele         keichele@is.dal.ca  
  37. http://is.dal.ca/~keichele/keichele.html
  38.  
  39.